<template>
  <van-cell 
    class="cinema-card" 
    :title="cinema.cinemaName" 
    :label="cinema.address" 
    clickable 
    @click="onDetail"
  >
    <div>
      <div><span class="price">{{ cinema.netPrice | ratePrice(discountRate, 100) }}元</span>起</div>
      <div>{{ cinema.distance | formatDistance }}</div>
    </div>
  </van-cell>
</template>

<script>
import { mapGetters } from 'vuex'
import { getRandomId } from '@/utils/util'
// 影院卡片
export default {
  name: 'CinemaCard',
  props: {
    cinema: {
      type: Object,
      default: () => {}
    }
  },
  computed: {
    ...mapGetters([
      'discountRate',
    ])
  },
  methods: {
    onDetail() {
      this.$router.push({
        path: `/cinema-detail/${this.cinema.cinemaId}`, 
        query: { random: getRandomId() } 
      })
    }
  },
}
</script>

<style lang="scss" scoped>
.cinema-card {
  /deep/ .van-cell__value {
    flex: none;
    margin-left: 5px;
  }
}
</style>